<template>
        <el-menu :default-openeds="['1', '3']" style="height: 100%; border-right-color: transparent;"
          background-color="rgb(178,144,98)" text-color="#fff" active-text-color="#ecb5ab" :collapse-transition="false"
          :collapse="isCollapse" router>
          <div style="height: 60px; line-height: 60px; text-align: center;">
            <img src="../assets/宠物手掌.png" alt=""
              style="height: 20px; width: 20px; position: relative; top: 5px; margin-right: 5px;">
            <b style="color: white;" v-show="logoTextShow">宠物领养中心</b>
          </div>
          <el-submenu index="1">
            <template slot="title"><i class="el-icon-message"></i>
              <span slot="title">主页</span>
            </template>
            <el-menu-item-group>
              
              <el-menu-item index="/Manage/first">主页</el-menu-item>
              <el-menu-item index="/Manage/person">个人信息</el-menu-item>
              <el-menu-item index="/Manage/adorecord">领养记录</el-menu-item>
              <el-menu-item index="/Manage/pethouse">宠物仓库</el-menu-item>
              <el-menu-item index="/Manage/noticeboard">公告栏</el-menu-item>
            </el-menu-item-group>
            
          </el-submenu>
          <!-- <el-submenu index="" v-if="isShow">
            
          </el-submenu> -->
          <el-submenu index="2" v-show="isShow">
            <template slot="title"><i class="el-icon-menu"></i>
              <span slot="title">后台管理</span>
              <b style="color: red" v-show="(this.user.type!=1)?false:(this.isFinished>=1)?true:false">
                    *
              </b>
            </template>
            <el-menu-item-group>
              <el-menu-item index="/Manage/user">用户管理</el-menu-item>
              <el-menu-item index="/Manage/pet">宠物管理</el-menu-item>
              <el-menu-item index="/Manage/adoption">领养管理
                <b style="color: red" v-show="(this.user.type!=1)?false:(this.isFinished>=1)?true:false">
                    *
                </b>
              </el-menu-item>
              <el-menu-item index="/Manage/notice">公告管理</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          
          
        </el-menu>
</template>
<script>
import axios from 'axios';

export default {
    name:"Aside",
    props: {
        isCollapse:Boolean,
        logoTextShow:Boolean,
        
    },
    data(){
      return{
        ado:[],
        isFinished:0,
        isShow:true,
        user:''
      }
        
    },
    created(){
      this.load();
      this.checkType();
    },
    methods:{
      checkType(){
        this.user=JSON.parse(sessionStorage.getItem("loginUser"));
        
        if(this.user.type!=1){
          this.isShow=false;
        }
      },
      load(){
            var param=new URLSearchParams();
            param.append("page",1);
            param.append("size",1000);
            axios({
                url:"http://localhost:8080/adoption/adoGet",
                method:"get",
                params:param
            }).then(res=>{
                
                this.ado=res.data.records;
                var i;
                for(i=0;i<this.ado.length;i++){
                    if(this.ado[i].adostatus===1){
                        this.isFinished=1;
                    }
                }
            })
        },
    }
}
</script>